from PIL import Image

image = Image.open("example.jpg")

# 调整图像大小
resized_image = image.resize((300, 200))

# 保存调整后的图像
resized_image.save("resized_example.jpg")